<template>
  <div class="box-bpdy box-primary">
    <div class="form-horizontal">
      <div class="box-body">
        <div class="form-group">
          <label class="col-sm-3 control-label my-label">当前部门:</label>
          <div class="col-sm-6">
            <label v-if="selectedNode">{{ selectedNode.name }}</label>
          </div>
        </div>
        <div class="form-group">
          <label class="col-sm-3 control-label my-label">账号:</label>
          <div class="col-sm-6">
            <el-input v-model="editAccount.user" placeholder="请输入账号" :disabled="edit"></el-input>
          </div>
        </div>
        <div class="form-group">
          <label class="col-sm-3 control-label my-label">绑定员工:</label>
          <div class="col-sm-6">
            <el-select v-model="editAccount.uid" placeholder="请选择用户" :disabled="edit">
              <el-option
                v-for="item in users"
                :key="item.id"
                :label="item.name"
                :value="item.id">
              </el-option>
            </el-select>
          </div>
        </div>
        <div class="form-group">
          <label class="col-sm-3 control-label my-label">绑定角色:</label>
          <div class="col-sm-6">
            <el-select v-model="editAccount.role" placeholder="请选择角色">
              <el-option
                v-for="item in roles"
                :key="item.id"
                :label="item.name"
                :value="item.id">
              </el-option>
            </el-select>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>
<script>
export default {
  name: "accountEdit",
  props: ['selectedNode',"account", "users","roles"],
  data: function() {
    return {
      editAccount: {
        user : '',
        uid : null,
        role: null,
        edit:false
      }
    }
  },
  mounted: function() {
    if (this.account) {
      this.editAccount = this.account
      this.edit=true
    }
    // if(this.users){
    //   this.editAccount.uid = this.users[0].id
    // }
  },
  methods: {
    getData() {
      return this.editAccount
    }
  }

}
</script>
